package com.example.javafx.bilibilidownload.pojo;

import lombok.Data;

/**
 * @author zengbang
 * @create 2024-08-09 09:51
 **/
@Data
public class BiliFuckWbiInfo {

    private String img_url;

    private String img_key;

    private String sub_url;

    private String sub_key;

    public BiliFuckWbiInfo(String img_url, String sub_url) {
        this.img_url = img_url;
        this.sub_url = sub_url;
        this.img_key = getFileNameWithoutExtension(img_url);
        this.sub_key = getFileNameWithoutExtension(sub_url);
    }

    public  String getFileNameWithoutExtension(String url) {
        // 截取最后一个斜杠后的部分
        String fileName = url.substring(url.lastIndexOf('/') + 1);
        // 去除扩展名
        return fileName.substring(0, fileName.lastIndexOf('.'));
    }
}
